<template>
	<view class="page" style="padding-top: 104rpx;">
		<view class="header">
			<image @click="back" class="back" src="../../static/tian/back.png" mode=""></image>
			<view class="text">{{$t('first.title57')}}</view>
			<view></view>
		</view>
		<view class="ArbitrageAIList_up">
			<view class="up_top">
				<image class="icon" src="../../static/tian/icon.png" mode=""></image>
				<view class="top_right">
					<view class="num">{{detailist.sum}}</view>
					<view class="text">{{$t('first.title58')}}</view>
				</view>
			</view>
			<view class="up_top" @click="godetail()">
				<image class="icon" src="../../static/tian/icon1.png" mode=""></image>
				<view class="top_right">
					<view class="num">{{detailist.profit}}</view>
					<view class="text">{{$t('first.title59')}}</view>
				</view>
				<image class="righticon" src="../../static/tian/right.png" mode=""></image>
			</view>
			<view class="ArbitrageAIList_down">
				<view class="down_title">{{$t('first.title60')}}</view>
				<view class="item" v-if="detailist.list.data" v-for="(item,index) in detailist.list.data">
					<view class="itemheader" style="margin-bottom: 18rpx;">
						<view class="left">{{item.number}}{{item.currency_name}}</view>
						<view v-if="item.status==0" class="right">{{$t('first.title61')}}</view>
						<view v-if="item.status==1" class="right2">{{$t('first.title134')}}</view>
					</view>
					<view class="itemheader">
						<view class="left1">
							{{item.created_at}}
						</view>
						<view style="display: flex;justify-content: flex-end;align-items: center;">
							<view class="left1">{{$t('first.title62')}}: <text style="font-weight: bold;">{{item.days - item.return_days}}</text>{{$t('first.title63')}}</view>
							<view class="right1" style="margin-left: 16rpx;">RATE: <text style="font-weight: bold;">{{(item.type.rate * 100).toFixed(2)}}</text>%</view>
						</view>
					</view>
				</view>
				<u-loadmore
					v-if="detailist.list.data"
					:status="loadmorestatus" 
					:loading-text="$t('first.title120')" 
					:loadmore-text="$t('first.title119')" 
					:nomore-text="$t('first.title121')"
					marginTop="18px"
				/>
				<view class="nodata" v-if="detailist.list.data.length==0">
					<image class="icon" src="../../static/tian/zanwu.png" mode=""></image>
					<view class="nodata_text">{{$t('first.title44')}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {domain} from '../../config/domain.js'
	export default{
		data(){
			return{
				detailist:[],
				page:1,
				loadmorestatus:'loadmore'
			}
		},
		onLoad(e) {
			this.userinfo= uni.getStorageSync('userinfo');
			this.getFinaceAccountDetail();
		},
		onReachBottom() {
			this.page++;
			if(this.page <= this.detailist.list.last_page){
				this.loadmorestatus = 'loading'
				var url=domain + 'api/new_dao_getFinaceAccountDetail?page=' + this.page;
				var mytype='get';
				uni.request({
					url,
					method: mytype,
					header: {
						'content-type': 'application/x-www-form-urlencoded' ,//自定义请求头信息
						'Lang':uni.getStorageSync('lang'),
						'AUTHORIZATION':this.userinfo.token,
					},
					success: res => {
						this.loadmorestatus = 'loadmore'
						if(res.data.code==0){
							uni.showToast({
								icon:'none',
								title:res.data.msg
							}); 
						}else{
							this.detailist.list.data = [...this.detailist.list.data,...res.data.data.list.data]
							if(this.detailist.list.last_page == 1){
								this.loadmorestatus = 'nomore'
							}
						}
					},
					fail: (err) => {
						this.loadmorestatus = 'loadmore'
						console.log(err)
					},
					complete: () => {
						this.loadmorestatus = 'loadmore'
						setTimeout(function() {
							uni.hideLoading();
						}, 1000);
					}
				});
			}else{
				this.loadmorestatus = 'nomore'
			}
		},
		methods:{
			godetail(){
				uni.navigateTo({
					url:'./detail'
				})
			},
			back(){
				uni.navigateBack()
			},
			getFinaceAccountDetail(){
				var url=domain + 'api/new_dao_getFinaceAccountDetail?page=' + this.page;
				var mytype='get';
			
				uni.request({
					url,
					method: mytype,
					
					header: {
						'content-type': 'application/x-www-form-urlencoded' ,//自定义请求头信息
						'Lang':uni.getStorageSync('lang'),
						'AUTHORIZATION':this.userinfo.token,
					},
					success: res => {
						if(res.data.code==0){
							uni.showToast({
								icon:'none',
								title:res.data.msg
							}); 
						}else{
							this.detailist=res.data.data
						}
					},
					fail: (err) => {
						console.log(err)
					},
					complete: () => {
						setTimeout(function() {
							uni.hideLoading();
						}, 1000);
					}
				});
			},
		}
	}
</script>

<style scoped>
	*{
		margin: 0;
		padding: 0;
		box-sizing: border-box;
	}
	.page{
		width: 100%;
		height: 100%;
		min-height: 100vh;
		background-color: #ecf0f5;
	}
	.header{
		width: 100%;
		height: 104rpx;
		padding: 20rpx;
		position: fixed;
		background-color: #ecf0f5;
		display: flex;
		top: 0;
		left: 0;
		align-items: center;
		justify-content: space-between;
		z-index: 999;
	}
	.back{
		width: 48rpx;
		height: 48rpx;
	}
	.header .text{
		font-size: 36rpx;
		font-family: PingFangSC-Medium,PingFang SC;
		font-weight: 600;
		color: #222;
	}
	.ArbitrageAIList_up{
		width: 100%;
		height: 544rpx;
		position: relative;
		padding: 40rpx;
		box-sizing: border-box;
	}
	.up_top{
		width: 100%;
		height: 186rpx;
		background: #fff;
		box-shadow: 0 0.18667rem 0.42667rem 0 rgb(0 0 0 / 8%);
		border-radius: 32rpx;
		margin-bottom: 40rpx;
		padding: 36rpx;
		box-sizing: border-box;
		display: flex;
		align-items: center;
	}
	.up_top .righticon{
		width: 60rpx;
		height: 60rpx;
	}
	.up_top .icon{
		width: 112rpx;
		height: 112rpx;
		margin-right: 32rpx;
	}
	.top_right{
		flex: 1;
	}
	.top_right .num{
		font-size: 48rpx;
		font-family: DINAlternate-Bold,DINAlternate;
		font-weight: 700;
		color: #0c0c0c;
		margin-bottom: 10rpx;
	}
	.top_right .text{
		font-size: 24rpx;
		font-family: PingFangSC-Regular,PingFang SC;
		font-weight: 400;
		color: #b2b2b2;
	}
	.ArbitrageAIList_down{
		position: absolute;
		top: 90%;
		left: 0;
		right: 0;
		width: 100%;
		background: #fff;
		box-shadow: 0 0.26667rem 0.66667rem 0 #f1f4f6;
		border-radius: 60rpx 60rpx 0 0;
		padding: 40rpx;
		box-sizing: border-box;
		min-height: 936rpx;
	}
	.down_title{
		font-size: 40rpx;
		font-family: PingFangSC-Semibold,PingFang SC;
		font-weight: 600;
		margin-bottom: 40rpx;
	}
	.nodata{
		width: 100%;
		height: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;
	}
	.nodata .icon{
		width: 420rpx;
		height: 366rpx;
	}
	.nodata_text{
		font-size: 28rpx;
		font-family: PingFangSC-Regular,PingFang SC;
		font-weight: 400;
		color: #9394bc;
	}
	.item{
		width: 100%;
		height: 146rpx;
		background: #fff;
		box-shadow: 0 0.18667rem 0.42667rem 0 rgb(0 0 0 / 8%);
		border-radius: 32rpx;
		margin-top: 40rpx;
		padding: 36rpx;
		box-sizing: border-box;
	}
	.itemheader{
		width: 100%;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	.itemheader .left{
		font-size: 32rpx;
		font-weight: bold;
		color: #323233;
	}
	.itemheader .left1{
		font-size: 24rpx;
		color: #858587;
	}
	.itemheader .right{
		font-size: 28rpx;
		color: #ffb40f;
	}
	.itemheader .right1{
		font-size: 24rpx;
		color: #858587;
	}
	.itemheader .right2{
		font-size: 24rpx;
		color: #00aa00;
	}
</style>